package com.djl.zenithbite.controller;

import com.djl.zenithbite.entity.UserAddressExample;
import com.djl.zenithbite.entity.UserExample;
import com.djl.zenithbite.repository.UserAddressMapper;
import com.djl.zenithbite.repository.UserMapper;
import com.djl.zenithbite.util.MailUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/test")
public class TestController {

    @Autowired
    private UserMapper userMapper;
    @Autowired
    private MailUtil mailUtil;

    @GetMapping("/link/mysql")
    public Object test(){
        UserExample userExample = new UserExample();
        UserExample.Criteria criteria = userExample.createCriteria();
        criteria.andUserNameEqualTo("testuser");

        return userMapper.selectByExample(userExample);
    }
    @GetMapping("/send/mail")
    public void test02(){
        //mailUtil.send("1649787014@qq.com","test","nishisb" );
        //mailUtil.send("1162601970@qq.com","test","nishimeinv" );
        mailUtil.send("2069589763@qq.com","test","<h1>哈哈哈哈哈哈哈哈哈</h1>" );
    }
}
